home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2779 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: rover.ucs.ualberta.ca!alberta!davidb
  2. From: davidb@cs.ualberta.ca (David Mccaughan)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: File Size in bytes.
  5. Date: 23 Jan 1996 23:10:20 GMT
  6. Organization: Computing Science, U of Alberta, Edmonton, Canada
  7. Message-ID: <4e3pss$1os@scapa.cs.ualberta.ca>
  8. References: <4e0r59$733@hammerhead.dadd.ti.com>
  9. NNTP-Posting-Host: sawnlk.cs.ualberta.ca
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Sudheer Vemulapalli (sudheer@dadd.ti.com) wrote:
  13.  
  14. : Is there a simple way to find the exact size of a file.I would like to know of
  15. : a way to do it other than using ls -l and getting the size field from the
  16. : output. If there is a UNIX system call or somefunction that returns the file
  17. : size please let me know.
  18.  
  19. Although this really isn't a C question specifically, check the man page for
  20. fstat() or stat().  These function read the file's i-node into a data
  21. structure, one field of which is the size of the file in bytes.
  22.  
  23. ----------------------------------------------------------------------------
  24.  David B. McCaughan                         Department of Computing Science
  25.  davidb@cs.ualberta.ca                                University of Alberta
  26.  http://web.cs.ualberta.ca/~davidb                          Alberta, CANADA
  27.     --------------------------------------------------------------------
  28.  "If you love something, write it in C; if it compiles, it is yours; if it
  29.   doesn't, it never was."
  30. ----------------------------------------------------------------------------
  31.